package com.peter.design.pattern.interpreter.calculate.v2;


import com.peter.design.pattern.interpreter.calculate.IArithmeticInterpreter;

import java.util.Stack;

public class GPCalculatorV2 {

    private Stack<IArithmeticInterpreter> intStack = new Stack<IArithmeticInterpreter>();

    private Stack<IArithmeticInterpreter> operatorStack = new Stack<IArithmeticInterpreter>();

    public GPCalculatorV2(String expression) {
        this.parse(expression);
    }

    private void parse(String expression) {
        String [] elements = expression.split(" ");
        IArithmeticInterpreter leftExpr, rightExpr;

        for (int i = 0; i < elements.length ; i++) {
            String operator = elements[i];

        }
    }

    public int calculate() {
        return this.intStack.pop().interpret();
    }
}